package com.scms.secondclass.service.impl;

import java.util.List;
import com.scms.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.scms.secondclass.mapper.CreditRecordMapper;
import com.scms.secondclass.domain.CreditRecord;
import com.scms.secondclass.service.ICreditRecordService;

/**
 * 学分记录Service业务层处理
 * 
 * @author thy
 * @date 2025-03-06
 */
@Service
public class CreditRecordServiceImpl implements ICreditRecordService 
{
    @Autowired
    private CreditRecordMapper creditRecordMapper;

    /**
     * 查询学分记录
     * 
     * @param recordId 学分记录主键
     * @return 学分记录
     */
    @Override
    public CreditRecord selectCreditRecordByRecordId(Long recordId)
    {
        return creditRecordMapper.selectCreditRecordByRecordId(recordId);
    }

    /**
     * 查询学分记录列表
     * 
     * @param creditRecord 学分记录
     * @return 学分记录
     */
    @Override
    public List<CreditRecord> selectCreditRecordList(CreditRecord creditRecord)
    {
        return creditRecordMapper.selectCreditRecordList(creditRecord);
    }

    /**
     * 新增学分记录
     * 
     * @param creditRecord 学分记录
     * @return 结果
     */
    @Override
    public int insertCreditRecord(CreditRecord creditRecord)
    {
        creditRecord.setCreateTime(DateUtils.getNowDate());
        return creditRecordMapper.insertCreditRecord(creditRecord);
    }

    /**
     * 修改学分记录
     * 
     * @param creditRecord 学分记录
     * @return 结果
     */
    @Override
    public int updateCreditRecord(CreditRecord creditRecord)
    {
        creditRecord.setUpdateTime(DateUtils.getNowDate());
        return creditRecordMapper.updateCreditRecord(creditRecord);
    }

    /**
     * 批量删除学分记录
     * 
     * @param recordIds 需要删除的学分记录主键
     * @return 结果
     */
    @Override
    public int deleteCreditRecordByRecordIds(Long[] recordIds)
    {
        return creditRecordMapper.deleteCreditRecordByRecordIds(recordIds);
    }

    /**
     * 删除学分记录信息
     * 
     * @param recordId 学分记录主键
     * @return 结果
     */
    @Override
    public int deleteCreditRecordByRecordId(Long recordId)
    {
        return creditRecordMapper.deleteCreditRecordByRecordId(recordId);
    }
}
